//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System;
using System.Collections.Generic;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Manageability;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Manageability.Adm;
using EntLibContrib.Resource;
using EntLibContrib.Resource.Configuration;

namespace EntLibContrib.Resource.Configuration.Manageability
{
	internal class ResourceProviderDataManageabilityProvider
		: ConfigurationElementManageabilityProviderBase<ResourceProviderData>
	{
		#region Properties
		protected override string ElementPolicyNameTemplate
		{
			get
			{
				return null;	// no policy for these elements
			}
		}
		#endregion

		#region Protected Methods
		protected override void AddAdministrativeTemplateDirectives(AdmContentBuilder contentBuilder,
			ResourceProviderData configurationObject,
			IConfigurationSource configurationSource,
			String elementPolicyKeyName)
		{
			// parts for providers are part of their resource manager's policies
			AddElementAdministrativeTemplateParts(contentBuilder,
				configurationObject,
				configurationSource,
				elementPolicyKeyName);
		}

		protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
			ResourceProviderData configurationObject, 
			IConfigurationSource configurationSource, 
			String elementPolicyKeyName)
		{
			// nothing to set for this part
			contentBuilder.AddTextPart(InternalResources.ResourceProviderNoSettingsPartName);
		}

		protected override void OverrideWithGroupPolicies(ResourceProviderData configurationObject, IRegistryKey policyKey)
		{
			throw new NotSupportedException();
		}

		protected override void GenerateWmiObjects(ResourceProviderData configurationObject, ICollection<ConfigurationSetting> wmiSettings)
		{
			throw new NotSupportedException();
		}
		#endregion
	}
}
